<template>
	<uni-popup ref="pop_economyPay">
		<view class="economyPay">
			<view class="black_1">
				<image class="img2" src="@/static/economy/pay_bg2.png"></image>
				<image @click="close()" class="img" src="/static/my/close.png"></image>
			</view>
			
			<uni-easyinput
			class="inputs inputs2"
			type="password" 
			v-model="password" 
			:inputBorder="false" 
			:styles="{backgroundColor: 'transparent'}"
			placeholder="请输入支付密码(默认密码666666)"
			placeholder-style="color:#FE903D;font-size:13px"
			></uni-easyinput>
			
			<view class="black_4">
				本次您需支付<text class="text1">{{price}}</text>
			</view>
			<view class="black_4" >绿色积分手续费:<text class="text1">{{shouxfei}}</text></view>
			
			
			<view class="black_5" @click="spay()">
				<view class="text1">确认支付</view>
			</view>
		</view>
	</uni-popup>
		
</template>

<script>
	export default {
		name:"economyPay",
		props: {
			success: {
				type: Function,
			}
		},
		data() {
			return {
				ids:'',
				num:'',
				password:'',
				price:'0',
				type:0,
				type2:0,
				shouxfei:0.0
			};
		},
		methods:{
			open(type,id,price,v1){
				this.ids = id
				this.price =price
				this.type =type
				
				this.shouxfei =Number(v1).toFixed(2)
				console.log(55555,this.shouxfei)
				this.$refs.pop_economyPay.open()
			},
			open2(type,id,price,v1){
				console.log(4444,Number(v1))
				console.log(4444,Number(price))
				this.ids = id
				this.price =price
				this.type =type
				this.shouxfei = v1
				this.$refs.pop_economyPay.open()
			},
			close(){
				this.$refs.pop_economyPay.close()
			},
			spay(){
					
				if(!this.password){
					uni.showToast({
						title:'请输入密码',
						icon:'none'
					})
					return
				}
				if(this.type == 0){
					this.success(this.password)
					this.close()
					return
				}
				var url ='jackpotshop/buy'
				if(this.type == 3){
					url = '/exchange/buy'
				}else if(this.type == 4) {
					url = '/exchange/sell'
				}
				this.api.http.requests(url, {id:this.ids, pay_password:this.password}, res => {
					uni.showToast({
						title:res.msg,
						icon:'none'
					})
					this.close()
				}, "POST")
				this.close()
			}
		}
	}
</script>

<style scoped lang="less">
	
.economyPay{
	background: linear-gradient(180deg, #FFE6D5 0%, #FFFFFF 100%);;
	border-radius: 16rpx;
	padding: 20px;
	width: 600upx;
	// width: 100%;
	height: auto;
}
.black_1{
	text-align: center;
	font-size: 27px;
	font-weight: 800;
	color: #333333;
	width: 100%;
	.img2{
		width: 189px;
		height: 120px;
		margin: 25px 10px 0px 10px;
	}
	.img{
		width: 25px;
		height: 25px;
		position: absolute;
		right: 10px;
		top: 10px;
	}
}
.black_2{
	margin-top: 20px;
	font-size: 18px;
	font-weight: 800;
	color: #333333;
}

.inputs{
		margin-top: 10px;
		padding: 5px 0px;
		border: 1px solid #FFE6D5;
		border-radius: 5px;
		font-size: 30rpx;
		font-weight: 400;
		background-color: #FFE6D5;
		// text-align: end;
	}
	.inputs2{
		margin:40px auto 10px auto;
		width: 250px;
		border-radius: 20px;
		text-align: center;
	}
	.black_4{
		text-align: center;
		font-size: 14px;
		font-weight: 400;
		color: #969696;
		.text1{
			margin-left: 5px;
			color: #FE903D;
		}
	}
	
	.black_5{
		margin: 40px auto 10px auto;
		width: 146px;
		height: 45px;
		line-height: 45px;
		color: white;
		text-align: center;
		background: #FE903D;
		border-radius: 10px 10px 10px 10px;
	}
	.black_6{
		text-align: center;
		font-size: 12px;
		font-weight: 400;
		color: #FFC248;
	}
</style>